Home:ALL Converter>What does /[\[]/ do in JavaScript?

What does /[\[]/ do in JavaScript?

Ask Time:2010-03-03T01:13:27         Author:user34537

Json Formatter

I am having trouble googling this. In some code I see

name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");

/[\[]/ looks to be 1 parameter. What do the symbols do? It looks like it's replacing [] with \[\] but what specifically does /[\[]/ do?

Author:user34537,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/2365118/what-does-do-in-javascript
yy